package ua.kratik.seabattle.domain;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;

import ua.kratik.seabattle.dao.DataObject;

@Entity
@Table (name = "fleets")
public class Fleet implements DataObject{
	

	@Id
	@Column
	private Integer id;
	
	@ManyToOne(fetch = FetchType.LAZY, optional = false)
	@JoinColumn(name = "battleRules_id")
	private BattleRules battleRules;
	
	@ManyToOne(fetch = FetchType.LAZY, optional = false)
	@JoinColumn(name = "ship_id")
	private Ship ship;
	
	@Column(name = "shipsCont")
	private Integer shipsCount;

	public BattleRules getBattleRules() {
		return battleRules;
	}

	public void setBattleRules(BattleRules battleRules) {
		this.battleRules = battleRules;
	}

	public Ship getShip() {
		return ship;
	}

	public void setShip(Ship ship) {
		this.ship = ship;
	}


	public Integer getId() {
		return id;
	}

	public void setId(Integer id) {
		this.id = id;
	}

	public Integer getShipsCount() {
		return shipsCount;
	}

	public void setShipsCount(Integer shipsCount) {
		this.shipsCount = shipsCount;
	}

	@Override
	public String toString() {
		return "Fleet [id=" + id + ", battleRules.id=" + battleRules.getId() + ", ship.name="
				+ ship.getName() + ", shipsCount=" + shipsCount + "]";
	}

}
